<?php
/**
 * 内容管理视图
 *
 *
 *
 */
// 排序
$arr_orderby    = array(
    'id'        => '&orderby=id',
    'job_name'  => '&orderby=job_name',
    'create_time'=> '&orderby=create_time',
    'end_time'  => '&orderby=end_time',
    'display'  => '&orderby=display',
    'num'       => '&orderby=num',
    'appnum'    => '&orderby=appnum',
    );
$orderby    = strtolower(trim(@$_GET['orderby']));
if(array_key_exists($orderby, $arr_orderby)) {
    $order_asc  = @(int)$_GET['desc'];
    $arr_orderby[$orderby] .= $order_asc == 0 ? '&desc=1' : '&desc=0';
} else {
    $arr_orderby['id'] .= '&desc=0';
}

// 保存数据框架名
$save_frame = $_SESSION[$G_admin_session_key]['save_frame'];
$back_url   = get_current_url();
// 将当前URL保存在Cookie中，避免复杂的URL字符串
cookie('back_url', strcode($back_url));
$url_cur    = get_current_url(array('orderby', 'desc'));


/**
 * 搜索参数处理
 *
 */
// 关键字
$key            = trim(@$_GET['key']);
// 是否包含子类
$class_id       = @(int)$_GET['class_id'];
$class_all      = @(int)$_GET['class_all'];
$chk_class_all  = ($class_all==1) ? ' checked' : '';
// 是否有效
$display       = trim(@$_GET['display']);
$chk_display_all   = '';
$chk_display__1    = '';
$chk_display_1     = '';
if($display == -1) {
    $chk_display__1 = ' checked';
} elseif($display == 1) {
    $chk_display_1 = ' checked';
} else {
    $chk_display_all = ' checked';
}


$begin_date = @$_GET['begin_date'];
$end_date   = @$_GET['end_date'];
$is_ad      = @(int)$_GET['is_ad'];

$dsp_ad     = ($is_ad == 1) ? 'style="display:block"':'style="display:none"';



$chk_haveimg    = @(int)$_GET['haveimg'] == 1 ? ' checked':'';
$chk_top        = @(int)$_GET['top'] == 1 ? ' checked':'';
$chk_new        = @(int)$_GET['new'] == 1 ? ' checked':'';
$chk_recommend  = @(int)$_GET['recommend'] == 1 ? ' checked':'';

// + -------------------------------------- + //
// 排序处理 - 为排序加上小图标

$order_by   = @trim($_GET['orderby']);
$order_desc = @(int)$_GET['desc'];

if($order_by != '') {
    $order_desc = ($order_desc!=1) ? 'sort_asc' : 'sort_desc' ;
    $this_param_style  = $order_by . '_style';
    $$this_param_style = '<div class="' . $order_desc . '"></div>';
}

// + -------------------------------------- + //


require($abs_admin_cppath . '/header.php');
?>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/popcalendar.js"></SCRIPT>


<div class="spH10"></div>


<div class="datacontainer1" id="listDiv">

<form action="<?php echo $mod_url['del'] ?>" name="items_form" method="post" target="<?php echo $save_frame?>" onsubmit="return submit_select_items(this.name, 'item_id[]');">
<TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" width="100%" class="list_table">
<THEAD>
	<TR class="list_head">
		<TH width='10%' scope=col>用户</TH>
		<TH width='10%' scope=col>类型</TH>
		<TH width='5%' scope=col>流向</TH>
		<TH width='10%' scope=col>金额</TH>
		<TH width='10%' scope=col>黄金劵</TH>
        <TH scope=col>备注</TH>
        <TH scope=col>对象</TH>
        <TH width='10%' scope=col>时间</TH>
		</TR></THEAD>
<TBODY>
<?php
$tr_class = '';
if(!empty($record) && sizeof($record) > 0) {
    foreach($record as $k=>$v) {
        $tr_class   = $tr_class != 'tr0' ? 'tr0' : 'tr1';
        if($v['type']==1){
            $objname=$lk_price[$v['object_id']];    
        }elseif($v['type']==0){
            $objname=$conn->GetOne("SELECT article_title from ".$_TABLES['article']." where aid={$v['object_id']}");
        }
		$username=$conn->GetOne("SELECT username from ".$_TABLES['members']." where uid={$v['userid']}");
?>
	<TR class="<?php echo $tr_class; ?>" onmouseover="return chgBg(this, 1);" onmouseout="return chgBg(this, 0);">
    <TD class="textC"><a href="/admin/admin.php?mod=members&action=modify&uid=<?php echo $v["userid"]?>"><?php echo $username; ?></a></TD>
		<TD class="textC"><?php echo $account_type[$v['type']]; ?></TD>
		<TD class="textC"><?php if($v['flow']){echo '<font color="#FFF" style="background-color:#F60;padding:2px;">流出</font>';}else{echo '<font color="#fff" style="background-color:#060;padding:2px;">充值</font>';}?></TD>
		<TD class="textC"><?php echo $v['balance'];?> 元</TD>
        <TD class="textC"><?php echo $v['amount'];?> 张</TD>
        <TD class="textC"><?php echo $v['remark'];?></TD>
        <TD class="textC"><?php echo $objname;?></TD>
        <TD class="textC"><?php echo $v['change_date'];?></TD>
		</TR>
<?php
    }
} else {
?>
<TR class="tr0" onmouseover="return chgBg(this, 1);" onmouseout="return chgBg(this, 0);">
<TD colspan="8">没有或没有找到合适的记录！</td>
</td>
<?php
}
?>
</TBODY>
</TABLE>
<?php
// 分页
$page_info  = "$record_total 条记录 共 $page_total 页 ";
$page_list  = get_page_nav($page_total);
?>

</form>
		</div>
</div>

<?php
require($abs_admin_cppath . '/footer.php');
?>